<template>
  <!-- 列表 -->
  <ContentWrap>
    <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
      <el-table-column label="id" align="center" prop="id" />
       <el-table-column label="存货编码" align="center" prop="inventoryCode" />
       <el-table-column label="规格型号" align="center" prop="inventoryName" />
       <el-table-column label="分类" align="center" prop="inventorySpecModel" />
       <el-table-column label="单位" align="center" prop="inventoryUnitName" />

      <el-table-column label="数量" align="center" prop="qty" />
      <el-table-column label="税率" align="center" prop="irate" />
      <el-table-column label="单价" align="center" prop="price" />
      <el-table-column label="含税单价" align="center" prop="itaxprice" />
      <el-table-column label="金额" align="center" prop="imoney" />
      <el-table-column label="税额" align="center" prop="itax" />
      <el-table-column label="价税合计" align="center" prop="isum" />
      <el-table-column label="备注" align="center" prop="cbmemo" />
      <el-table-column
        label="创建时间"
        align="center"
        prop="createTime"
        :formatter="dateFormatter"
        width="180px"
      />
    </el-table>
  </ContentWrap>
</template>
<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import { PomainApi } from '@/api/wms/pomain'

const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗

const props = defineProps<{
  pid?: number // 主表ID（主表的关联字段）
}>()
const loading = ref(false) // 列表的加载中
const list = ref([]) // 列表的数据

/** 查询列表 */
const getList = async () => {
  loading.value = true
  try {
    list.value = await PomainApi.getPomainsListByPid(props.pid)
  } finally {
    loading.value = false
  }
}

/** 搜索按钮操作 */
const handleQuery = () => {
  queryParams.pageNo = 1
  getList()
}

/** 初始化 **/
onMounted(() => {
  getList()
})
</script>